package com.me.myFramework.myDI;

import com.me.myFramework.myDI.service.UserService;
import com.me.myFramework.myDI.util.AnnotationConfigApplicationContext;
import com.me.myFramework.myDI.util.MyBeanFactory;

/**
 * 手写 Spring: 自己实现依赖注入
 *
 * @author ME
 * @date   2019/12/9
 */
public class TestMyDI {

    public static void main(String[] args) {
        // XML配置
        MyBeanFactory beanFactory = new MyBeanFactory("com/me/myFramework/myDI/myBeans.xml");
        UserService service = beanFactory.getBean("service");
        service.find();

        // 注解配置
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
        context.scan("com.me.myFramework.myDI");
    }
}
